package com.exam.sacrifice.util;

import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;

public class RotationAnimation {

    public static void rotateImage(ImageView imageView) {
        // 创建旋转动画
        RotateAnimation rotate = new RotateAnimation(
                0, 360, // 起始和结束角度
                Animation.RELATIVE_TO_SELF, 0.5f, // 旋转中心X
                Animation.RELATIVE_TO_SELF, 0.5f  // 旋转中心Y
        );

        rotate.setDuration(5000); // 动画持续时间
        rotate.setRepeatCount(Animation.INFINITE); // 无限循环
        imageView.startAnimation(rotate);
    }

    // 停止动画
    public static void stopRotation(ImageView imageView) {
        imageView.clearAnimation();
    }
}